package com.example.spring.demo.service.impl;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.spring.demo.common.model.req.MyGoodsParam;
import com.example.spring.demo.entity.Goods;
import com.example.spring.demo.mapper.GoodsMapper;
import com.example.spring.demo.service.GoodsService;
import org.springframework.stereotype.Service;

@Service
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements GoodsService {
    //获取我的订单
    @Override
    public IPage<Goods> getMyOrder(MyGoodsParam param) {
        //构造分页对象
        IPage<Goods> page = new Page<>(param.getCurPage(),param.getPageSize());
        return this.baseMapper.getMyOrder(page,param.getUserId());
    }

    //获取我的出售订单
    @Override
    public IPage<Goods> getSellOrder(MyGoodsParam param) {
        //构造分页对象
        IPage<Goods> page = new Page<>(param.getCurPage(),param.getPageSize());
        return this.baseMapper.getSellOrder(page,param.getUserId());
    }
}
